public final class Bzip2Decompressor {
	private static Bzip2Entry block = new Bzip2Entry();

	public static int method312(byte[] is, int i, byte[] is_0_, int i_1_, int i_2_) {
		synchronized (Bzip2Decompressor.block) {
			(Bzip2Decompressor.block).aByteArray47 = is_0_;
			(Bzip2Decompressor.block).anInt48 = i_2_;
			(Bzip2Decompressor.block).aByteArray52 = is;
			(Bzip2Decompressor.block).anInt53 = 0;
			(Bzip2Decompressor.block).anInt49 = i_1_;
			(Bzip2Decompressor.block).anInt54 = i;
			(Bzip2Decompressor.block).anInt61 = 0;
			(Bzip2Decompressor.block).anInt60 = 0;
			(Bzip2Decompressor.block).anInt50 = 0;
			(Bzip2Decompressor.block).anInt51 = 0;
			(Bzip2Decompressor.block).anInt55 = 0;
			(Bzip2Decompressor.block).anInt56 = 0;
			(Bzip2Decompressor.block).anInt63 = 0;
			Bzip2Decompressor.method314(Bzip2Decompressor.block);
			i -= (Bzip2Decompressor.block).anInt54;
			return i;
		}
	}

	private static void method313(Bzip2Entry bzip2Entry) {
		byte i = (bzip2Entry).aByte57;
		int i_3_ = (bzip2Entry).anInt58;
		int i_4_ = (bzip2Entry).anInt68;
		int i_5_ = (bzip2Entry).anInt66;
		int[] is = Bzip2Entry.anIntArray71;
		int i_6_ = (bzip2Entry).anInt65;
		byte[] is_7_ = (bzip2Entry).aByteArray52;
		int i_8_ = (bzip2Entry).anInt53;
		int i_9_ = (bzip2Entry).anInt54;
		int i_10_ = i_9_;
		int i_11_ = (bzip2Entry).anInt85 + 1;
		while_12_: for (;;) {
			if (i_3_ > 0) {
				for (;;) {
					if (i_9_ == 0) {
						break while_12_;
					}
					if (i_3_ == 1) {
						break;
					}
					is_7_[i_8_] = i;
					i_3_--;
					i_8_++;
					i_9_--;
				}
				if (i_9_ == 0) {
					i_3_ = 1;
					break;
				}
				is_7_[i_8_] = i;
				i_8_++;
				i_9_--;
			}
			boolean bool = true;
			while (bool) {
				bool = false;
				if (i_4_ == i_11_) {
					i_3_ = 0;
					break while_12_;
				}
				i = (byte) i_5_;
				i_6_ = is[i_6_];
				int i_12_ = (byte) (i_6_ & 0xff);
				i_6_ >>= 8;
				i_4_++;
				if (i_12_ != i_5_) {
					i_5_ = i_12_;
					if (i_9_ == 0) {
						i_3_ = 1;
						break while_12_;
					}
					is_7_[i_8_] = i;
					i_8_++;
					i_9_--;
					bool = true;
				} else if (i_4_ == i_11_) {
					if (i_9_ == 0) {
						i_3_ = 1;
						break while_12_;
					}
					is_7_[i_8_] = i;
					i_8_++;
					i_9_--;
					bool = true;
				}
			}
			i_3_ = 2;
			i_6_ = is[i_6_];
			int i_13_ = (byte) (i_6_ & 0xff);
			i_6_ >>= 8;
			if (++i_4_ != i_11_) {
				if (i_13_ != i_5_) {
					i_5_ = i_13_;
				} else {
					i_3_ = 3;
					i_6_ = is[i_6_];
					i_13_ = (byte) (i_6_ & 0xff);
					i_6_ >>= 8;
					if (++i_4_ != i_11_) {
						if (i_13_ != i_5_) {
							i_5_ = i_13_;
						} else {
							i_6_ = is[i_6_];
							i_13_ = (byte) (i_6_ & 0xff);
							i_6_ >>= 8;
							i_4_++;
							i_3_ = (i_13_ & 0xff) + 4;
							i_6_ = is[i_6_];
							i_5_ = (byte) (i_6_ & 0xff);
							i_6_ >>= 8;
							i_4_++;
						}
					}
				}
			}
		}
		int i_14_ = (bzip2Entry).anInt55;
		(bzip2Entry).anInt55 += i_10_ - i_9_;
		if ((bzip2Entry).anInt55 < i_14_) {
			(bzip2Entry).anInt56++;
		}
		(bzip2Entry).aByte57 = i;
		(bzip2Entry).anInt58 = i_3_;
		(bzip2Entry).anInt68 = i_4_;
		(bzip2Entry).anInt66 = i_5_;
		Bzip2Entry.anIntArray71 = is;
		(bzip2Entry).anInt65 = i_6_;
		(bzip2Entry).aByteArray52 = is_7_;
		(bzip2Entry).anInt53 = i_8_;
		(bzip2Entry).anInt54 = i_9_;
	}

	private static void method314(Bzip2Entry bzip2Entry) {
		int i = 0;
		int[] is = null;
		int[] is_33_ = null;
		int[] is_34_ = null;
		(bzip2Entry).anInt62 = 1;
		if (Bzip2Entry.anIntArray71 == null) {
			Bzip2Entry.anIntArray71 = new int[(bzip2Entry).anInt62 * 100000];
		}
		boolean bool_35_ = true;
		while (bool_35_) {
			byte i_36_ = Bzip2Decompressor.method315(bzip2Entry);
			if (i_36_ == 23) {
				break;
			}
			i_36_ = Bzip2Decompressor.method315(bzip2Entry);
			i_36_ = Bzip2Decompressor.method315(bzip2Entry);
			i_36_ = Bzip2Decompressor.method315(bzip2Entry);
			i_36_ = Bzip2Decompressor.method315(bzip2Entry);
			i_36_ = Bzip2Decompressor.method315(bzip2Entry);
			(bzip2Entry).anInt63++;
			i_36_ = Bzip2Decompressor.method315(bzip2Entry);
			i_36_ = Bzip2Decompressor.method315(bzip2Entry);
			i_36_ = Bzip2Decompressor.method315(bzip2Entry);
			i_36_ = Bzip2Decompressor.method315(bzip2Entry);
			i_36_ = Bzip2Decompressor.method316(bzip2Entry);
			if (i_36_ != 0) {
				(bzip2Entry).aBoolean59 = true;
			} else {
				(bzip2Entry).aBoolean59 = false;
			}
			if ((bzip2Entry).aBoolean59) {
				System.out.println("PANIC! RANDOMISED BLOCK!");
			}
			(bzip2Entry).anInt64 = 0;
			int i_37_ = Bzip2Decompressor.method315(bzip2Entry);
			(bzip2Entry).anInt64 = (bzip2Entry).anInt64 << 8 | i_37_ & 0xff;
			i_37_ = Bzip2Decompressor.method315(bzip2Entry);
			(bzip2Entry).anInt64 = (bzip2Entry).anInt64 << 8 | i_37_ & 0xff;
			i_37_ = Bzip2Decompressor.method315(bzip2Entry);
			(bzip2Entry).anInt64 = (bzip2Entry).anInt64 << 8 | i_37_ & 0xff;
			for (int i_38_ = 0; i_38_ < 16; i_38_++) {
				i_36_ = Bzip2Decompressor.method316(bzip2Entry);
				if (i_36_ == 1) {
					(bzip2Entry).aBooleanArray74[i_38_] = true;
				} else {
					(bzip2Entry).aBooleanArray74[i_38_] = false;
				}
			}
			for (int i_39_ = 0; i_39_ < 256; i_39_++) {
				(bzip2Entry).aBooleanArray73[i_39_] = false;
			}
			for (int i_40_ = 0; i_40_ < 16; i_40_++) {
				if ((bzip2Entry).aBooleanArray74[i_40_]) {
					for (int i_41_ = 0; i_41_ < 16; i_41_++) {
						i_36_ = Bzip2Decompressor.method316(bzip2Entry);
						if (i_36_ == 1) {
							(bzip2Entry).aBooleanArray73[(i_40_ * 16 + i_41_)] = true;
						}
					}
				}
			}
			Bzip2Decompressor.method318(bzip2Entry);
			int i_42_ = (bzip2Entry).anInt72 + 2;
			int i_43_ = Bzip2Decompressor.method317(3, bzip2Entry);
			int i_44_ = Bzip2Decompressor.method317(15, bzip2Entry);
			for (int i_45_ = 0; i_45_ < i_44_; i_45_++) {
				int i_46_ = 0;
				for (;;) {
					i_36_ = Bzip2Decompressor.method316(bzip2Entry);
					if (i_36_ == 0) {
						break;
					}
					i_46_++;
				}
				(bzip2Entry).aByteArray79[i_45_] = (byte) i_46_;
			}
			byte[] is_47_ = new byte[6];
			for (byte i_48_ = 0; i_48_ < i_43_; i_48_++) {
				is_47_[i_48_] = i_48_;
			}
			for (int i_49_ = 0; i_49_ < i_44_; i_49_++) {
				byte i_50_ = (bzip2Entry).aByteArray79[i_49_];
				byte i_51_ = is_47_[i_50_];
				for (/**/; i_50_ > 0; i_50_--) {
					is_47_[i_50_] = is_47_[i_50_ - 1];
				}
				is_47_[0] = i_51_;
				(bzip2Entry).aByteArray78[i_49_] = i_51_;
			}
			for (int i_52_ = 0; i_52_ < i_43_; i_52_++) {
				int i_53_ = Bzip2Decompressor.method317(5, bzip2Entry);
				for (int i_54_ = 0; i_54_ < i_42_; i_54_++) {
					for (;;) {
						i_36_ = Bzip2Decompressor.method316(bzip2Entry);
						if (i_36_ == 0) {
							break;
						}
						i_36_ = Bzip2Decompressor.method316(bzip2Entry);
						if (i_36_ == 0) {
							i_53_++;
						} else {
							i_53_--;
						}
					}
					(bzip2Entry).aByteArrayArray80[i_52_][i_54_] = (byte) i_53_;
				}
			}
			for (int i_55_ = 0; i_55_ < i_43_; i_55_++) {
				int i_56_ = 32;
				byte i_57_ = 0;
				for (int i_58_ = 0; i_58_ < i_42_; i_58_++) {
					if ((bzip2Entry).aByteArrayArray80[i_55_][i_58_] > i_57_) {
						i_57_ = ((bzip2Entry).aByteArrayArray80[i_55_][i_58_]);
					}
					if ((bzip2Entry).aByteArrayArray80[i_55_][i_58_] < i_56_) {
						i_56_ = ((bzip2Entry).aByteArrayArray80[i_55_][i_58_]);
					}
				}
				Bzip2Decompressor.method319((bzip2Entry).anIntArrayArray81[i_55_],
					(bzip2Entry).anIntArrayArray82[i_55_], (bzip2Entry).anIntArrayArray83[i_55_],
					(bzip2Entry).aByteArrayArray80[i_55_], i_56_, i_57_, i_42_);
				(bzip2Entry).anIntArray84[i_55_] = i_56_;
			}
			int i_59_ = (bzip2Entry).anInt72 + 1;
			int i_61_ = -1;
			int i_62_ = 0;
			for (int i_63_ = 0; i_63_ <= 255; i_63_++) {
				(bzip2Entry).anIntArray67[i_63_] = 0;
			}
			int i_64_ = 4095;
			for (int i_65_ = 15; i_65_ >= 0; i_65_--) {
				for (int i_66_ = 15; i_66_ >= 0; i_66_--) {
					(bzip2Entry).aByteArray76[i_64_] = (byte) (i_65_ * 16 + i_66_);
					i_64_--;
				}
				(bzip2Entry).anIntArray77[i_65_] = i_64_ + 1;
			}
			int i_67_ = 0;
			if (i_62_ == 0) {
				i_61_++;
				i_62_ = 50;
				byte i_68_ = (bzip2Entry).aByteArray78[i_61_];
				i = (bzip2Entry).anIntArray84[i_68_];
				is = (bzip2Entry).anIntArrayArray81[i_68_];
				is_34_ = (bzip2Entry).anIntArrayArray83[i_68_];
				is_33_ = (bzip2Entry).anIntArrayArray82[i_68_];
			}
			i_62_--;
			int i_69_ = i;
			int i_70_;
			int i_71_;
			for (i_71_ = Bzip2Decompressor.method317(i_69_, bzip2Entry); i_71_ > is[i_69_]; i_71_ = i_71_ << 1
				| i_70_) {
				i_69_++;
				i_70_ = Bzip2Decompressor.method316(bzip2Entry);
			}
			int i_72_ = is_34_[i_71_ - is_33_[i_69_]];
			while (i_72_ != i_59_) {
				if (i_72_ == 0 || i_72_ == 1) {
					int i_73_ = -1;
					int i_74_ = 1;
					do {
						if (i_72_ == 0) {
							i_73_ += i_74_;
						} else if (i_72_ == 1) {
							i_73_ += i_74_ * 2;
						}
						i_74_ *= 2;
						if (i_62_ == 0) {
							i_61_++;
							i_62_ = 50;
							byte i_75_ = (bzip2Entry).aByteArray78[i_61_];
							i = (bzip2Entry).anIntArray84[i_75_];
							is = (bzip2Entry).anIntArrayArray81[i_75_];
							is_34_ = (bzip2Entry).anIntArrayArray83[i_75_];
							is_33_ = (bzip2Entry).anIntArrayArray82[i_75_];
						}
						i_62_--;
						i_69_ = i;
						for (i_71_ = Bzip2Decompressor.method317(i_69_, bzip2Entry); i_71_ > is[i_69_]; i_71_ = i_71_ << 1
							| i_70_) {
							i_69_++;
							i_70_ = Bzip2Decompressor.method316(bzip2Entry);
						}
						i_72_ = is_34_[i_71_ - is_33_[i_69_]];
					} while (i_72_ == 0 || i_72_ == 1);
					i_73_++;
					i_37_ = ((bzip2Entry).aByteArray75[((bzip2Entry).aByteArray76[(bzip2Entry).anIntArray77[0]]) & 0xff]);
					(bzip2Entry).anIntArray67[i_37_ & 0xff] += i_73_;
					for (/**/; i_73_ > 0; i_73_--) {
						Bzip2Entry.anIntArray71[i_67_] = i_37_ & 0xff;
						i_67_++;
					}
				} else {
					int i_76_ = i_72_ - 1;
					if (i_76_ < 16) {
						int i_77_ = (bzip2Entry).anIntArray77[0];
						i_36_ = (bzip2Entry).aByteArray76[i_77_ + i_76_];
						for (/**/; i_76_ > 3; i_76_ -= 4) {
							int i_78_ = i_77_ + i_76_;
							(bzip2Entry).aByteArray76[i_78_] = (bzip2Entry).aByteArray76[i_78_ - 1];
							(bzip2Entry).aByteArray76[i_78_ - 1] = (bzip2Entry).aByteArray76[i_78_ - 2];
							(bzip2Entry).aByteArray76[i_78_ - 2] = (bzip2Entry).aByteArray76[i_78_ - 3];
							(bzip2Entry).aByteArray76[i_78_ - 3] = (bzip2Entry).aByteArray76[i_78_ - 4];
						}
						for (/**/; i_76_ > 0; i_76_--) {
							(bzip2Entry).aByteArray76[i_77_ + i_76_] = ((bzip2Entry).aByteArray76[i_77_
								+ i_76_ - 1]);
						}
						(bzip2Entry).aByteArray76[i_77_] = i_36_;
					} else {
						int i_79_ = i_76_ / 16;
						int i_80_ = i_76_ % 16;
						int i_81_ = (bzip2Entry).anIntArray77[i_79_] + i_80_;
						i_36_ = ((Bzip2Entry) bzip2Entry).aByteArray76[i_81_];
						for (/**/; i_81_ > ((Bzip2Entry) bzip2Entry).anIntArray77[i_79_]; i_81_--) {
							((Bzip2Entry) bzip2Entry).aByteArray76[i_81_] = ((Bzip2Entry) bzip2Entry).aByteArray76[i_81_ - 1];
						}
						((Bzip2Entry) bzip2Entry).anIntArray77[i_79_]++;
						for (/**/; i_79_ > 0; i_79_--) {
							((Bzip2Entry) bzip2Entry).anIntArray77[i_79_]--;
							((Bzip2Entry) bzip2Entry).aByteArray76[((Bzip2Entry) bzip2Entry).anIntArray77[i_79_]] = (((Bzip2Entry) bzip2Entry).aByteArray76[(((Bzip2Entry) bzip2Entry).anIntArray77[i_79_ - 1] + 16 - 1)]);
						}
						((Bzip2Entry) bzip2Entry).anIntArray77[0]--;
						((Bzip2Entry) bzip2Entry).aByteArray76[(((Bzip2Entry) bzip2Entry).anIntArray77[0])] = i_36_;
						if (((Bzip2Entry) bzip2Entry).anIntArray77[0] == 0) {
							int i_82_ = 4095;
							for (int i_83_ = 15; i_83_ >= 0; i_83_--) {
								for (int i_84_ = 15; i_84_ >= 0; i_84_--) {
									((Bzip2Entry) bzip2Entry).aByteArray76[i_82_] = (((Bzip2Entry) bzip2Entry).aByteArray76[(((Bzip2Entry) bzip2Entry).anIntArray77[i_83_])
										+ i_84_]);
									i_82_--;
								}
								((Bzip2Entry) bzip2Entry).anIntArray77[i_83_] = i_82_ + 1;
							}
						}
					}
					((Bzip2Entry) bzip2Entry).anIntArray67[(((Bzip2Entry) bzip2Entry).aByteArray75[i_36_ & 0xff]) & 0xff]++;
					Bzip2Entry.anIntArray71[i_67_] = ((Bzip2Entry) bzip2Entry).aByteArray75[i_36_ & 0xff] & 0xff;
					i_67_++;
					if (i_62_ == 0) {
						i_61_++;
						i_62_ = 50;
						byte i_85_ = ((Bzip2Entry) bzip2Entry).aByteArray78[i_61_];
						i = ((Bzip2Entry) bzip2Entry).anIntArray84[i_85_];
						is = ((Bzip2Entry) bzip2Entry).anIntArrayArray81[i_85_];
						is_34_ = ((Bzip2Entry) bzip2Entry).anIntArrayArray83[i_85_];
						is_33_ = ((Bzip2Entry) bzip2Entry).anIntArrayArray82[i_85_];
					}
					i_62_--;
					i_69_ = i;
					for (i_71_ = Bzip2Decompressor.method317(i_69_, bzip2Entry); i_71_ > is[i_69_]; i_71_ = i_71_ << 1
						| i_70_) {
						i_69_++;
						i_70_ = Bzip2Decompressor.method316(bzip2Entry);
					}
					i_72_ = is_34_[i_71_ - is_33_[i_69_]];
				}
			}
			((Bzip2Entry) bzip2Entry).anInt58 = 0;
			((Bzip2Entry) bzip2Entry).aByte57 = (byte) 0;
			((Bzip2Entry) bzip2Entry).anIntArray69[0] = 0;
			for (int i_86_ = 1; i_86_ <= 256; i_86_++) {
				((Bzip2Entry) bzip2Entry).anIntArray69[i_86_] = ((Bzip2Entry) bzip2Entry).anIntArray67[i_86_ - 1];
			}
			for (int i_87_ = 1; i_87_ <= 256; i_87_++) {
				((Bzip2Entry) bzip2Entry).anIntArray69[i_87_] += ((Bzip2Entry) bzip2Entry).anIntArray69[i_87_ - 1];
			}
			for (int i_88_ = 0; i_88_ < i_67_; i_88_++) {
				i_37_ = (byte) (Bzip2Entry.anIntArray71[i_88_] & 0xff);
				Bzip2Entry.anIntArray71[(((Bzip2Entry) bzip2Entry).anIntArray69[i_37_ & 0xff])] |= i_88_ << 8;
				((Bzip2Entry) bzip2Entry).anIntArray69[i_37_ & 0xff]++;
			}
			((Bzip2Entry) bzip2Entry).anInt65 = Bzip2Entry.anIntArray71[((Bzip2Entry) bzip2Entry).anInt64] >> 8;
			((Bzip2Entry) bzip2Entry).anInt68 = 0;
			((Bzip2Entry) bzip2Entry).anInt65 = Bzip2Entry.anIntArray71[((Bzip2Entry) bzip2Entry).anInt65];
			((Bzip2Entry) bzip2Entry).anInt66 = (byte) (((Bzip2Entry) bzip2Entry).anInt65 & 0xff);
			((Bzip2Entry) bzip2Entry).anInt65 >>= 8;
			((Bzip2Entry) bzip2Entry).anInt68++;
			((Bzip2Entry) bzip2Entry).anInt85 = i_67_;
			Bzip2Decompressor.method313(bzip2Entry);
			if (((Bzip2Entry) bzip2Entry).anInt68 == ((Bzip2Entry) bzip2Entry).anInt85 + 1
				&& ((Bzip2Entry) bzip2Entry).anInt58 == 0) {
				bool_35_ = true;
			} else {
				bool_35_ = false;
			}
		}
	}

	private static byte method315(Bzip2Entry bzip2Entry) {
		return (byte) Bzip2Decompressor.method317(8, bzip2Entry);
	}

	private static byte method316(Bzip2Entry bzip2Entry) {
		return (byte) Bzip2Decompressor.method317(1, bzip2Entry);
	}

	private static int method317(int i, Bzip2Entry bzip2Entry) {
		int i_89_;
		for (;;) {
			if (((Bzip2Entry) bzip2Entry).anInt61 >= i) {
				int i_90_ = ((((Bzip2Entry) bzip2Entry).anInt60 >> ((Bzip2Entry) bzip2Entry).anInt61 - i) & (1 << i) - 1);
				((Bzip2Entry) bzip2Entry).anInt61 -= i;
				i_89_ = i_90_;
				break;
			}
			((Bzip2Entry) bzip2Entry).anInt60 = (((Bzip2Entry) bzip2Entry).anInt60 << 8 | (((Bzip2Entry) bzip2Entry).aByteArray47[((Bzip2Entry) bzip2Entry).anInt48] & 0xff));
			((Bzip2Entry) bzip2Entry).anInt61 += 8;
			((Bzip2Entry) bzip2Entry).anInt48++;
			((Bzip2Entry) bzip2Entry).anInt49--;
			((Bzip2Entry) bzip2Entry).anInt50++;
			if (((Bzip2Entry) bzip2Entry).anInt50 == 0) {
				((Bzip2Entry) bzip2Entry).anInt51++;
			}
		}
		return i_89_;
	}

	private static void method318(Bzip2Entry bzip2Entry) {
		((Bzip2Entry) bzip2Entry).anInt72 = 0;
		for (int i = 0; i < 256; i++) {
			if (((Bzip2Entry) bzip2Entry).aBooleanArray73[i]) {
				((Bzip2Entry) bzip2Entry).aByteArray75[((Bzip2Entry) bzip2Entry).anInt72] = (byte) i;
				((Bzip2Entry) bzip2Entry).anInt72++;
			}
		}
	}

	private static void method319(int[] is, int[] is_91_, int[] is_92_, byte[] is_93_, int i,
		int i_94_, int i_95_) {
		int i_96_ = 0;
		for (int i_97_ = i; i_97_ <= i_94_; i_97_++) {
			for (int i_98_ = 0; i_98_ < i_95_; i_98_++) {
				if (is_93_[i_98_] == i_97_) {
					is_92_[i_96_] = i_98_;
					i_96_++;
				}
			}
		}
		for (int i_99_ = 0; i_99_ < 23; i_99_++) {
			is_91_[i_99_] = 0;
		}
		for (int i_100_ = 0; i_100_ < i_95_; i_100_++) {
			is_91_[is_93_[i_100_] + 1]++;
		}
		for (int i_101_ = 1; i_101_ < 23; i_101_++) {
			is_91_[i_101_] += is_91_[i_101_ - 1];
		}
		for (int i_102_ = 0; i_102_ < 23; i_102_++) {
			is[i_102_] = 0;
		}
		int i_103_ = 0;
		for (int i_104_ = i; i_104_ <= i_94_; i_104_++) {
			i_103_ += is_91_[i_104_ + 1] - is_91_[i_104_];
			is[i_104_] = i_103_ - 1;
			i_103_ <<= 1;
		}
		for (int i_105_ = i + 1; i_105_ <= i_94_; i_105_++) {
			is_91_[i_105_] = (is[i_105_ - 1] + 1 << 1) - is_91_[i_105_];
		}
	}
}
